package com.kstech.test.wqc.View;

import android.app.Activity;
import android.os.SystemClock;
import android.util.Log;

/**
 * Created by lenovo on 2016/11/2.
 */

public class DataFactoryThread extends Thread{
    private DataChangeListenner listenner;
    private DataShowView view;
    private Activity ctx;
    private int delay;

    public DataFactoryThread(DataChangeListenner listenner, DataShowView view , Activity ctx ,int delay) {
        this.listenner = listenner;
        this.view = view;
        this.ctx = ctx;
        this.delay = delay;
    }

    @Override
    public void run() {
        while(true){
            Log.i("DATA","------------"+Thread.currentThread().getName()+"------------data-------------------------");
            double value = Math.random()*100;
            int data = (int)value;
            listenner.onChanged(data+" ",view ,ctx);
            SystemClock.sleep(delay*1000);
        }
    }
}
